package com.warmheart.core.co.model;

import java.io.Serializable;

import org.apache.commons.lang3.StringUtils;

import com.warmheart.core.co.enums.SqlLinkTypeEnum;

/**
 * 
 * @ClassName: RelationModel
 * @Description: 自定义查询关系模型
 * @author ZhangJianyang
 * @date 2025-06-16 09:37:02
 *
 */
public class RelationModel implements Serializable {

    private static final long serialVersionUID = 1L;

    private String fieldName;

    private String relationType;

    private Object fieldValue;

    private String sqlType;

    private String likeType;

    private Boolean isDate;

    private String format;

    public RelationModel(String fieldName, String relationType, Object fieldValue, Boolean isDate, String format,
            SqlLinkTypeEnum sqlLinkTypeEnum, String likeType) {
        this.fieldName = fieldName;
        this.relationType = relationType;
        this.fieldValue = fieldValue;
        this.isDate = isDate;
        this.format = format;
        if (this.isDate && StringUtils.isBlank(this.format)) {
            // 默认格式化
            this.format = "yyyy-MM-dd";
        }
        if (!this.isDate) {
            this.format = null;
        }
        this.sqlType = sqlLinkTypeEnum.getValue();
        this.likeType = likeType;
    }

    public String getFieldName() {
        return fieldName;
    }

    public String getRelationType() {
        return relationType;
    }

    public Object getFieldValue() {
        return fieldValue;
    }

    public String getSqlType() {
        return sqlType;
    }

    public String getLikeType() {
        return likeType;
    }

    public Boolean getIsDate() {
        return isDate;
    }

    public String getFormat() {
        return format;
    }
}